﻿/**
 * @file   FITKAbaqusAdaptorInertia.h
 * @brief 惯性 适配器
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-05-29
 */
#ifndef __FITKABAQUSADAPTORINERTIA__H__
#define __FITKABAQUSADAPTORINERTIA__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include <QHash>
 //前置声明
ForwardDeclarNS(AbaqusData, FITKDataCase)
ForwardDeclarNS(Interface, FITKAbaAbstractInertia)
ForwardDeclarNS(Interface, FITKAbaInertiaPointMassInertia)
ForwardDeclarNS(Interface, FITKModelSet)
ForwardDeclarNS(AbaqusData, FITKAbaqusPart)
ForwardDeclarNS(Interface, FITKAbaAssembly)

namespace IO
{

    /**
     * @brief 惯性 适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-05-28
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorInertia : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorInertia() = default;
        ~FITKAbaqusAdaptorInertia() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-28
         */
        QString getAdaptorClass() override;

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date  2024-05-28
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date  2024-05-28
         */
        bool adaptW() override;
        /**
         * @brief 设置写出单元的编号
         * @param writeElementId elementId
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-28
         */
        void setWriteElementId(int* writeElementId);
        /**
         * @brief 设置PartData
         * @param partData partData
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        void setPartData(AbaqusData::FITKAbaqusPart* partData);
        /**
         * @brief 设置AssemblyData
         * @param assemblyData 装配数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        void setAssemblyData(Interface::FITKAbaAssembly* assemblyData);

    private:
        /**
         * @brief 读取质量点
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool readPointMassa();
        /**
         * @brief 读取转动惯量
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool readRotaryInertia();
        /**
         * @brief 通过名称获取坐标系id
         * @param orientationName 坐标系名称
         * @param csysId 获取的坐标系Id
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        bool getCsysIdByName(QString orientationName, int &csysId);
        /**
         * @brief 写出Element
         * @param type 类型
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool writeElement(QString type);
        /**
         * @brief 写出Element里的成员编号
         * @param set 集合
         * @param modelId 模型Id
         * @param num 累加的编号
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool writeElementID(Interface::FITKModelSet* set, int modelId);
        /**
         * @brief 写出质量点/惯量
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool writePointMassInertia();
        /**
         * @brief 写出质量点
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool writePointMass();
        /**
         * @brief 写出转动惯量
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        bool writeRotaryInertia();
        /**
         * @brief 写出非结构质量
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-02
         */
        bool writeNonstructuralMass();
        /**
         * @brief 写出热容
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-02
         */
        bool writeHeatCapacitance();
        /**
         * @brief 通过坐标系id获取坐标系名称
         * @return 坐标系名称 -失败返回空
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        QString getCsysNameById(int csysId);

    private:
        /**
         * @brief partData
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        AbaqusData::FITKAbaqusPart* _partData{};
        /**
         * @brief Assembly
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-11
         */
        Interface::FITKAbaAssembly* _assemblyData{};
        /**
         * @brief 写出的编号
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        int* _writeElementId{};
    };
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaAbstractInertia, FITKAbaqusAdaptorInertia, 1)
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaInertiaPointMassInertia, FITKAbaqusAdaptorInertia, 2)
}

#endif
